<template>
<div>
  <p><input type="text" v-model="form.name"></p>
  <p><input type="text" v-model="form.password"></p>
  <button @click="login">登录</button>

</div>
</template>

<script>
export default {
  name: "tlogin",
  data(){
    return{
      form:{}
    }
  },
  methods:{
    login(){
      this.$axios.post('users/Ttecher_API/',this.form)
      .then(i=>{
        if(i.data.code == 200){
          alert('登录成功')
          localStorage.setItem('userid',i.data.userid)
          localStorage.setItem('name',i.data.name)
          this.$router.push('tzhuye/')
        }
        else {
          alert("登陆失败")
        }
      })
    }
  },
  mounted() {
  }
}
</script>

<style scoped>

</style>
